package com.talos.ums.dal.mysql.scopeorganization;

import com.talos.framework.common.pojo.PageResult;
import com.talos.framework.mybatis.core.mapper.BaseMapperX;
import com.talos.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.talos.ums.controller.admin.scopeorganization.vo.UmsScopeOrganizationPageReqVO;
import com.talos.ums.dal.dataobject.scopeorganization.UmsScopeOrganizationDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 经营范围组织关联表 Mapper
 *
 * @author ${table.author}
 */
@Mapper
public interface UmsScopeOrganizationMapper extends BaseMapperX<UmsScopeOrganizationDO> {

    default PageResult<UmsScopeOrganizationDO> selectPage(UmsScopeOrganizationPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<UmsScopeOrganizationDO>()
                .eqIfPresent(UmsScopeOrganizationDO::getScopeId, reqVO.getScopeId())
                .eqIfPresent(UmsScopeOrganizationDO::getOrganizationId, reqVO.getOrganizationId())
                .eqIfPresent(UmsScopeOrganizationDO::getOrganizationCode, reqVO.getOrganizationCode())
                .betweenIfPresent(UmsScopeOrganizationDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(UmsScopeOrganizationDO::getCreatorCode, reqVO.getCreatorCode())
                .likeIfPresent(UmsScopeOrganizationDO::getCreatorName, reqVO.getCreatorName())
                .betweenIfPresent(UmsScopeOrganizationDO::getModifyTime, reqVO.getModifyTime())
                .eqIfPresent(UmsScopeOrganizationDO::getModifierCode, reqVO.getModifierCode())
                .likeIfPresent(UmsScopeOrganizationDO::getModifierName, reqVO.getModifierName())
                .eqIfPresent(UmsScopeOrganizationDO::getTenantCode, reqVO.getTenantCode())
                .eqIfPresent(UmsScopeOrganizationDO::getTenantId, reqVO.getTenantId())
                .eqIfPresent(UmsScopeOrganizationDO::getCreatorId, reqVO.getCreatorId())
                .eqIfPresent(UmsScopeOrganizationDO::getModifierId, reqVO.getModifierId())
                .orderByDesc(UmsScopeOrganizationDO::getId));
    }

}
